<script language="JavaScript" type="text/javascript">
    function cont_seller()
    {
        var req = null; 
        if(window.XMLHttpRequest)
            req = new XMLHttpRequest(); 
        else if (window.ActiveXObject)
            req  = new ActiveXObject(Microsoft.XMLHTTP); 
        req.onreadystatechange = function()
        { 
                    
            document.getElementById('sale_car').innerHTML = "<div align='center'></div>" ;               
            if(req.readyState == 4)
            {
                var ajaxDisplay = document.getElementById('sale_car');
                ajaxDisplay.innerHTML = req.responseText;
                       
            }  
        };
        
        var my_name = document.getElementById('cus_name').value;
        if(my_name=='')
        {
            document.getElementById('cust_error').innerHTML = "Required" ;  
            document.getElementById('cust_error').focus();
            return false;
        }
                    
                        
        var my_email = document.getElementById('cus_email').value;
        var atpos=my_email.indexOf("@");
        var dotpos=my_email.lastIndexOf(".");
        if(my_email=='')
        {
            document.getElementById('email_error').innerHTML = "Required" ;  
            document.getElementById('cus_email').focus();
            return false;       
        }
       else if (atpos<1 || dotpos<atpos+2 || dotpos+2>=my_email.length|| my_email==' ')
        {
            document.getElementById('email_error').innerHTML = "Not Valid Email" ; 
            document.getElementById('cus_email').focus();
            return false;
                   
        }
        
        var my_contact = document.getElementById('cus_contact').value;
        if(my_contact=='')
        { 
            
            document.getElementById('contact_error').innerHTML = "Required" ;  
            document.getElementById('contact_error').focus();
            return false;
        }
        else if(my_contact.length<10){
            document.getElementById('contact_error').innerHTML = "Minimum 10 Digit" ;  
            document.getElementById('contact_error').focus();
            return false;
        }
        
        var my_location = document.getElementById('cus_location').value;
        if(my_location=='')
        {
            document.getElementById('loc_error').innerHTML = "Required" ; 
            document.getElementById('cus_location').focus();
            return false;
        }
                    
        var my_query = document.getElementById('cus_query').value;
        if(my_query=='')
        {
            document.getElementById('desc_error').innerHTML = "Required" ; 
            document.getElementById('cus_query').focus();
            return false;
        }
        var queryString =  "my_name=" + my_name + "&my_contact=" + my_contact + "&my_email=" + my_email + "&my_location=" + my_location + "&my_query=" + my_query;
        req.open("POST", "<?= base_url(); ?>ajax/submit_contact_seller" , true); 
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
        req.send(queryString); 
       
    } 
</script>
<style type="text/css">
    .error{color:red}
</style>
<div id="inner" >
    <p>
    <div class="bold color_2 " > <h2> <?= $title; ?> </h2> </div> 
    <div class="font_1 color_2"> All Fields are Mandatory. Please fill correct information.</div>
    <span class="error" id="sucess-msg"></span>
</p>

<div class="clear"></div>
<form class="form3" id="sale_car" method="post" action="#" style="background-color:honeydew">
    <div class="rowElem">
        <div class="fleft">
            <label><strong>Your Name</strong></label>
            <span class="error"id="cust_error"></span>
            <input name="cus_name" id="cus_name" type="text" size="19" style="width: 190px" />
        </div>
        <div class="fleft marg_left">
            <label><strong>Your Email</strong></label>
            <span class="error"id="email_error"></span>
            <input name="cus_email" id="cus_email" type="text" size="19" style="width: 190px" />
        </div>                                    
        <div class="clear"></div>        
    </div>

    <div class="rowElem">
        <div class="fleft">
            <label><strong>Contact No</strong></label>
            <span class="error"id="contact_error"></span>
            <input name="cus_contact" id="cus_contact" type="text" size="19" style="width: 190px" />
        </div>
        <div class="fleft marg_left">
            <label><strong>Location <span class="font_1"> ( City, State ) </span></strong></label>
            <span class="error" id="loc_error"></span>
            <input name="cus_location" id="cus_location" type="text" size="19" style="width: 190px" />
        </div>                                    
        <div class="clear"></div>
    </div>

    <div class="rowElem">
        <div class="fleft">
            <label><strong>Description </strong></label>
            <span class="error" id="desc_error"></span>
            <textarea  name="cus_query" id="cus_query" cols="50" rows="4"></textarea>
        </div>
        <div class="clear"></div>
    </div>

    <div class="rowElem">
        <div class="fleft">
            <a onClick="cont_seller();" class="button_search color_1 bold"><span class="inline-block">Send Now !</span></a>
        </div>
        <div class="clear"></div>
    </div>
</form>
</div>

